<template>
  <div class="form-inline form-filter">
    <div class="form-group form-group-sm">
      <input type="text" class="form-control" v-model="filter.fundId" placeholder="资金账号">
    </div>
    <div class="form-group form-group-sm">
      <select class="form-control" v-model="filter.status">
        <option value="">全部</option>
        <option value="0">未审核</option>
        <option value="1">审核已通过</option>
        <option value="-1">审核已拒绝</option>
        <option value="-2">通知ebroker失败</option>
        <option value="-3">免佣设置失败</option>
      </select>
    </div>
    <button class="btn btn-sm btn-primary" @click="searchList">搜索</button>
  </div>
  <table v-show="list && list.length > 0" class="table table-bordered">
    <caption>港股入金审核</caption>
    <thead>
      <tr>
        <th>资金账号</th>
        <th colspan="4">入金信息</th>
        <th colspan="2">审核</th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      <template v-for="it in list">
        <tr>
          <td rowspan="4">{{it.fundId}}</td>
          <td class="text-right">转入银行</td>
          <td>{{it.bankNameStr}}</td>
          <td class="text-right">收款账号</td>
          <td>{{it.bankCardNo}}</td>
          <td class="text-right">状态</td>
          <td class="col-nowrap">
            <span v-if=" +it.status === -3 ">免佣设置失败</span>
            <span v-if=" +it.status === -2 ">通知ebroker失败</span>
            <span v-if=" +it.status === -1 ">已拒绝</span>
            <span v-if=" +it.status === 1 ">已通过</span>
            <span v-if=" +it.status === 0 ">未审核</span>
          </td>
          <td rowspan="4" class="col-nowrap text-right">
            <div v-if=" +it.status === 0 || +it.status === -2 ">
              <button class="btn btn-sm btn-primary" @click="updateItem(it, 1)">通过</button>
              <button class="btn btn-sm btn-primary" @click="updateItem(it, -1)">拒绝</button>
            </div>
          </td>
        </tr>
        <tr>
          <td class="text-right">币种</td>
          <td>{{it.curName}}</td>
          <td class="text-right">渠道</td>
          <td>
            <div v-if=" +it.status === 1 ">{{it.moneyChannel}}</div>
            <input v-if=" +it.status === 0 || +it.status === -2 " type="text" class="form-control input-sm" v-model="it.moneyChannel">
          </td>
          <td class="text-right">审核人员</td>
          <td>{{it.auditOperator}}</td>
        </tr>
        <tr>
          <td class="text-right">用户存入</td>
          <td>{{it.tranamt}}</td>
          <td class="text-right">实际到账</td>
          <td>
            <div v-if=" +it.status === 1 ">{{it.realTranamt}}</div>
            <input v-if=" +it.status === 0 || +it.status === -2 " type="text" class="form-control input-sm" v-model="it.realTranamt">
          </td>
          <td class="text-right">审核时间</td>
          <td><span v-if=" it.auditTime ">{{it.auditTime | timeToString}}</span></td>
        </tr>
        <tr>
          <td class="text-right">凭证</td>
          <td><a v-if="it.moneyVoucherUrl" :href="it.moneyVoucherUrl" target="_blank">查看凭证</a></td>
          <td class="text-right">创建时间</td>
          <td>{{it.createTime | timeToString}}</td>
          <td class="text-right">备注</td>
          <td>
            <div v-if=" +it.status === 1 || +it.status=== -1 ">{{it.remark}}</div>
            <textarea v-if=" +it.status === 0 || +it.status=== -2 " class="form-control" v-model="it.remark" rows="3"></textarea>
          </td>
        </tr>
      </template>
    </tbody>
  </table>
  <vue-pages :pages.sync="pages" :get-list="getList"></vue-pages>
</template>
<style src="./audit-list.css" scoped></style>
<script src="./audit-list.js"></script>